package cn.telling.sellercentre.service.impl;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.telling.sellerCenter.service.ISellerBasePriceService;
import cn.telling.sellerCenter.vo.SellerBasePrice;
import cn.telling.sellerCenter.vo.SellerBasePriceVo;
import cn.telling.sellercentre.dao.ISellerBasePriceDao;

/**
 * @Description: 基准价格处理Service
 * @author liugeng
 *
 */
@Service("sellerBasePriceService")
public class SellerBasePriceServiceImpl implements ISellerBasePriceService {
	
	@Autowired	
	private ISellerBasePriceDao sellerBasePriceDao;
	
	public ISellerBasePriceDao getSellerBasePriceDao() {
		return sellerBasePriceDao;
	}
	public void setSellerBasePriceDao(ISellerBasePriceDao sellerBasePriceDao) {
		this.sellerBasePriceDao = sellerBasePriceDao;
	}
	
	/**
	 * 判断是否存在基准价格
	 */
	@Override
	public boolean hasSellerBasePrice(String supplyId, String productId) {
		SellerBasePrice sellerBasePrice = sellerBasePriceDao.getSellerBasePrice(supplyId, productId);
		if(sellerBasePrice != null){
			return true;
		}
		return false;
	}
	
	/**
	 * 获取基准价格
	 */
	@Override
	public SellerBasePrice getSellerBasePrice(String supplyId, String productId) {
		SellerBasePrice sellerBasePrice = sellerBasePriceDao.getSellerBasePrice(supplyId, productId);
		if(sellerBasePrice != null){
			return sellerBasePrice;
		}
		return null;
	}
	
	/**
	 * 入库基准价格
	 */
	@Override
	public int insertSellerBsePrice(SellerBasePrice sellerBasePrice) {
		return sellerBasePriceDao.insertSellerBsePrice(sellerBasePrice);
	}
	
	/**
	 * 更新基准价格
	 */
	@Override
	public int updateSellerBasePrice(BigDecimal basePrice, BigDecimal userId,String supplyId, String productId) {
		return sellerBasePriceDao.updateSellerBasePrice(basePrice, userId, supplyId, productId);
	}
	
	/**批量更新基准价格*/
	@Override
	public int updateSellerBasePriceBatch(List<SellerBasePrice> sellerBasePriceList) {
		return sellerBasePriceDao.updateSellerBasePriceBatch(sellerBasePriceList);
	}
	
	/**获得基准价格列表*/
	@Override
	public List<SellerBasePriceVo> getgetSellerBasePriceList(String supplyId) {
		return sellerBasePriceDao.getgetSellerBasePriceList(supplyId);
	}
	
	/**获得基准价格列表  非通讯市场*/
	@Override
	public List<SellerBasePriceVo> getSellerBasePriceList(String supplyId) {
		return sellerBasePriceDao.getSellerBasePriceList(supplyId);
	}
	
	@Override
	public List<SellerBasePriceVo> getgetSellerBasePriceListOne(String supplyId,String productfirstSortId ,String productSortId) {
		// TODO Auto-generated method stub
		return  sellerBasePriceDao.getgetSellerBasePriceListOne(supplyId,productfirstSortId, productSortId);
	}

}
